package com.fqcar.fqdf.adapter;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.fqcar.fqdf.R;
import com.fqcar.fqdf.entity.CarDetailEntity;
import com.fqdf.framework.android.adapter.BaseMyAdapter;

import java.util.List;

import butterknife.BindView;
import butterknife.ButterKnife;

public class SearchCarAdapter extends BaseMyAdapter<CarDetailEntity> {

    public SearchCarAdapter(Context context) {
        super(context);
    }

    public SearchCarAdapter(Context context, List<CarDetailEntity> objects) {
        super(context, objects);
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        ViewHolder holder;
        if (convertView == null) {
            convertView = View.inflate(getContext(), R.layout.search_car_list_item, null);
            holder = new ViewHolder(convertView);
            convertView.setTag(holder);
        } else
            holder = (ViewHolder) convertView.getTag();

        CarDetailEntity carDetailEntity = getItem(position);

        holder.searchCarPlateNum.setText(carDetailEntity.getCarNum());

        return convertView;
    }


    static class ViewHolder {
        @BindView(R.id.search_car_plate_num)
        TextView searchCarPlateNum;

        ViewHolder(View view) {
            ButterKnife.bind(this, view);
        }
    }
}
